package tech.aistar.day01;

import java.util.Arrays;
public class ParamTransferDemo {
    public static void main(String[] args) {
        System.out.println(10 ^ 8);
        System.out.println(10 ^ 8 ^ 8);
        int a = 10;
        int b = 20;
        chang(a, b);
        System.out.println("main-a:" + a);
        System.out.println("main-b" + b);
        int[] arr1 = {1, 2, 3};
        int[] arr2 = {1, 2, 3};
        add(arr1, arr2);
        System.out.println("main-arr1->" + Arrays.toString(arr1));
        System.out.println("main-arr2->" + Arrays.toString(arr2));

    }

    private static void add(int[] arr1, int[] arr2) {
        for (int i = 0; i < arr2.length; i++) {
            arr2[i] = arr2[i] + 10;
        }
        arr1 = arr2;

        System.out.println("add->"+ Arrays.toString(arr1));//11,12,13
        System.out.println("add->"+ Arrays.toString(arr2));//11,12,13
    }
    private static void chang(int a,int b){
        a=a^b;
        b=a^b;
        a=a^b;
        System.out.println("change-a->"+a);
        System.out.println("change-b->"+b);
    }
}
